
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Day02 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.2">
        
        
        
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="Day03.html" />
    
    
    <link rel="prev" href="Day01.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="Day01.html">
            
                <a href="Day01.html">
            
                    
                    Day01
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.3" data-path="Day02.html">
            
                <a href="Day02.html">
            
                    
                    Day02
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="Day03.html">
            
                <a href="Day03.html">
            
                    
                    Day03
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="Day04-1.html">
            
                <a href="Day04-1.html">
            
                    
                    Day04-1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="Day04-2.html">
            
                <a href="Day04-2.html">
            
                    
                    Day04-2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="Day05-2.html">
            
                <a href="Day05-2.html">
            
                    
                    Day05-1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="Day05-1.html">
            
                <a href="Day05-1.html">
            
                    
                    Day05-2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="Day06.html">
            
                <a href="Day06.html">
            
                    
                    Day06
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >Day02</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="centos6&#x5B89;&#x88C5;nginx&#x603B;&#x7ED3;">Centos6&#x5B89;&#x88C5;nginx&#x603B;&#x7ED3;</h1>
<p>Date: <code>2017&#x5E74;6&#x6708;8&#x65E5;</code>
Author: <code>MF.&#x8D3E;</code>
Env&#xFF1A;<code>centos6.9-x86_64</code></p>
<h2 id="1-&#x6DFB;&#x52A0;nginx&#x5B98;&#x65B9;yum&#x6E90;">1 &#x6DFB;&#x52A0;nginx&#x5B98;&#x65B9;yum&#x6E90;</h2>
<p><code>vim /etc/yum.repos.d/nginx.repo</code>  &#x6DFB;&#x52A0;&#x4EE5;&#x4E0B;&#x5185;&#x5BB9;&#xFF1A;</p>
<pre><code>[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
</code></pre><h2 id="2-yum&#x5B89;&#x88C5;nginx&#x5305;">2 yum&#x5B89;&#x88C5;nginx&#x5305;</h2>
<p><code>yum search nginx</code> &#x67E5;&#x8BE2;nginx&#x5BF9;&#x5E94;&#x7684;&#x5305;
<code>yum -y install nginx.x86_64</code> yum&#x5B89;&#x88C5;nginx&#x5305;</p>
<h2 id="3-&#x5F00;&#x542F;&#x5173;&#x95ED;&#x67E5;&#x770B;&#x91CD;&#x542F;nginx&#x670D;&#x52A1;">3 &#x5F00;&#x542F;/&#x5173;&#x95ED;/&#x67E5;&#x770B;/&#x91CD;&#x542F;nginx&#x670D;&#x52A1;</h2>
<table>
<thead>
<tr>
<th>&#x547D;&#x4EE4;&#x64CD;&#x4F5C;</th>
<th>&#x547D;&#x4EE4;&#x4F5C;&#x7528;</th>
</tr>
</thead>
<tbody>
<tr>
<td>service nginx start</td>
<td>&#x542F;&#x52A8;nginx&#x670D;&#x52A1;</td>
</tr>
<tr>
<td>service nginx status</td>
<td>&#x67E5;&#x770B;nginx&#x670D;&#x52A1;</td>
</tr>
<tr>
<td>service nginx stop</td>
<td>&#x5173;&#x95ED;nginx&#x670D;&#x52A1;</td>
</tr>
<tr>
<td>service nginx restart</td>
<td>&#x91CD;&#x542F;nginx&#x670D;&#x52A1;</td>
</tr>
</tbody>
</table>
<h2 id="3-&#x4FEE;&#x6539;&#x7AEF;&#x53E3;&#x4E3A;8080">3 &#x4FEE;&#x6539;&#x7AEF;&#x53E3;&#x4E3A;8080</h2>
<p><code>vim /etc/nginx/conf.d/default.conf</code> &#x4FEE;&#x6539;listen&#x7AEF;&#x53E3;&#xFF1A;
<code>listen       8080;</code></p>
<h2 id="4-&#x670D;&#x52A1;&#x5668;&#x672C;&#x5730;&#x9A8C;&#x8BC1;web&#x8BBF;&#x95EE;">4 &#x670D;&#x52A1;&#x5668;&#x672C;&#x5730;&#x9A8C;&#x8BC1;web&#x8BBF;&#x95EE;</h2>
<p><code>curl http://127.0.0.1:8080</code></p>
<h2 id="5-&#x5BA2;&#x6237;&#x7AEF;&#x6D4F;&#x89C8;&#x5668;&#x9A8C;&#x8BC1;web&#x8BBF;&#x95EE;">5 &#x5BA2;&#x6237;&#x7AEF;&#x6D4F;&#x89C8;&#x5668;&#x9A8C;&#x8BC1;web&#x8BBF;&#x95EE;</h2>
<pre><code class="lang-http://xxx.xxx.xxx.xxx:8080```">&#x5730;&#x5740;&#x53EF;&#x4EE5;&#x4ECE;`ifconfig`&#x5F97;&#x5230;
&#x5982;&#x679C;&#x65E0;&#x6CD5;&#x8BBF;&#x95EE;&#xFF0C;&#x53C2;&#x7167;`&#x6B65;&#x9AA4;6`

## 6 &#x5141;&#x8BB8;80&#x548C;8080&#x7AEF;&#x53E3;&#x8BBF;&#x95EE;
&#x4FEE;&#x6539;&#x547D;&#x4EE4;&#xFF1A;
```iptables -I INPUT -p tcp --dport 80 -j ACCEPT
</code></pre>
<p><code>iptables -I INPUT -p tcp --dport 8080 -j ACCEPT</code>
&#x67E5;&#x770B;&#x547D;&#x4EE4;&#xFF1A;
<code>/etc/init.d/iptables status</code> </p>
<h2 id="7-&#x5378;&#x8F7D;nginx">7 &#x5378;&#x8F7D;nginx</h2>
<p><code>rpm -aq | grep nginx</code>
<code>rpm -e nginx-1.12.0-1.el6.ngx.x86_64</code>
&#x5FFD;&#x7565;&#x4F9D;&#x8D56;&#x5173;&#x7CFB;&#x4F7F;&#x7528;&#xFF1A;
<code>rpm -e --nodeps nginx-1.12.0-1.el6.ngx.x86_64</code></p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="Day01.html" class="navigation navigation-prev " aria-label="Previous page: Day01">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="Day03.html" class="navigation navigation-next " aria-label="Next page: Day03">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"Day02","level":"1.3","depth":1,"next":{"title":"Day03","level":"1.4","depth":1,"path":"Day03.md","ref":"Day03.md","articles":[]},"previous":{"title":"Day01","level":"1.2","depth":1,"path":"Day01.md","ref":"Day01.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["livereload"],"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"Day02.md","mtime":"2017-06-08T15:48:15.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-07-01T15:45:14.694Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

